{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5ca67d47",
   "metadata": {},
   "source": [
    "# math包 测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "643bea2c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c635f1ea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15.874507866387544"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 平方嗯\n",
    "math.sqrt(252)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a088c822",
   "metadata": {},
   "source": [
    "向上取整math.ceil， 向下取整math.floor， 取整部分math.trunc(对正数相当于floor， 对负数相当于ceil)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4e2c6876",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.ceil(3.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ab6d7401",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-4"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.floor(3.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5af1918f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-3"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.trunc(-3.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "da2217fd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
